package com.zyh.enumdemo;

public class EnumDemo2 {
    public static void main(String[] args) {
        Week[] weeks = Week.values();
        for (Week week : weeks) {
            System.out.println("week = " + week);
        }
        try {
            Week week1 = Week.valueOf("星期六");
            System.out.println("week1 = " + week1);
        } catch (IllegalArgumentException e) {
            System.out.println("输入有误！");
        } finally {
            System.exit(0);
        }
    }
}

enum Week {
    星期一,
    星期二,
    星期三,
    星期四,
    星期五,
    星期六,
    星期日,
}
